<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   design_default
 * @package    Mage
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/**
 * Product view template
 *
 * @see Mage_Catalog_Block_Product_View
 * @see Mage_Review_Block_Product_View
 */
?>

<script>
		/* jQuery(document).ready(function($) {
			var n = $( "div.option-wrapper" ).length;
			if(n>0){
				$('body').addClass('option-product-body');
			}
			
			//Change text add to wishlist & add to compare
			$('.add-to-links .link-wishlist').text('Wishlist');
			$('.add-to-links .link-compare').text('Compare');
		}); */
</script>


<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>
<script type="text/javascript">
    var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
	$jsmart("#yt_tab_products").ready( function($) {
		$jsmart("#yt_tab_products").ytContentTabs();
	} );     
</script>



<div id="messages_product_view"> <?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
<div class="yt-product-detail">
	<div class="yt-product-detail-inner">
		<div class="product-essential">
			<div class="row">
			
				<div class="col-md-9">
					<form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form" <?php if($_product->getOptions()): ?> enctype="multipart/form-data" <?php endif; ?>>
						<div class="row">
							<div class="yt-detail-left col-md-4-view col-md-6 col-sm-6">
								<div class="product-img-box">
									<?php echo $this->getChildHtml('media') ?>
								</div>
								
							</div>
							<div class="yt-detail-right col-md-5-view col-md-6 col-sm-6">
								<div class="product-shop">
									<h1 class="product-name">
										<?php echo $_helper->productAttribute($_product, $this->htmlEscape($_product->getName()), 'name') ?>
									</h1>
									
									<div class="product-review">
										<?php  echo $this->getReviewsSummaryHtml($_product, "short", true); ?>
									</div>
									
									<?php echo $this->getChildHtml('alert_urls') ?>
									<?php echo $this->getChildHtml('product_type_data') ?>
									<?php echo $this->getTierPriceHtml() ?>
									<?php echo $this->getChildHtml('extrahint') ?>
									
									<?php if ($_product->getShortDescription()):?>
										<div class="short-description">
											<?php echo $_helper->productAttribute($_product, $_product->getshort_description(), 'short_description'); ?>
										</div>
									<?php endif;?>
									
									<div class="like-social">
										<div class="addthis_toolbox addthis_default_style ">
										<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
										<iframe allowtransparency="true" frameborder="0" scrolling="no" src="https://platform.twitter.com/widgets/tweet_button.html" style="width:95px; height:20px; float:left;"></iframe>						                              
										<!--<a class="addthis_button_pinterest_pinit" pi:pinit:layout="horizontal"></a>-->
										<a class="addthis_counter addthis_pill_style"></a>						
										</div>
										<script type="text/javascript">var addthis_config = {"data_track_addressbar":false};</script>
									   
										<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-529be2200cc72db5"></script>
										
									</div>
									
									<fieldset class="no-display">
										<input type="hidden" name="product" value="<?php echo $_product->getId() ?>" /> 
										<input type="hidden" name="related_product" id="related-products-field" value="" />
									</fieldset>

									<?php if (!$this->hasOptions()):?>
										<div class="add-to-box">
											<?php if($_product->isSaleable()): ?>
												<?php echo $this->getChildHtml('addtocart') ?>
											<?php endif; ?>
											<?php echo $this->getChildHtml('addto') ?>
										</div>
										<?php echo $this->getChildHtml('extra_buttons') ?>
									<?php elseif (!$_product->isSaleable()): ?>
										<div class="add-to-box">
											<?php echo $this->getChildHtml('addto') ?>
										</div>
									<?php endif; ?>
									
									<?php echo $this->getChildHtml('other');?>
									<?php if ($_product->isSaleable() && $this->hasOptions()):?>
									<?php echo $this->getChildChildHtml('container1', '', true, true) ?>
									<?php endif;?>
								</div>

								<div class="clearer"></div>
												
										<?php if ($_product->isSaleable() && $this->hasOptions()):?>
											<div class="option-wrapper" id="wapper_option_product">
												<div class="action-product">
												<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
												</div>
											</div>
										<?php endif;?>	
							</div>
						</div>
					</form>
					<div class="row">
						<div id="yt_tab_products" class="col-md-12 tab-product-detail">
							<ul class="yt-tab-navi clearfix">
								<?php if ($_description = $this->getChildHtml('description')):?>
								<li>
									<a href="#yt_tab_decription"><?php echo $this->__('Description') ?></a>
								</li>
								<?php endif; ?>
														
								<?php if($review_form = $this->getChildHtml('review_form')): ?>
								<li>
									<a href="#yt_tab_reviewform"><?php echo $this->__('Write Your Own Review') ?></a>
								</li>
								<?php endif; ?>
								<?php if($product_additional_data = $this->getChildHtml('product_additional_data')): ?>
								<li>
									<a href="#yt_tab_tags"><?php echo $this->__('Product Tags') ?></a>
								</li>
								<?php endif; ?>	
								<?php if ($_additional = $this->getChildHtml('additional')):?>
									<li>
										<a href="#yt_tab_additional"><?php echo $this->__('Additional Information') ?></a>
									</li>
								<?php endif; ?>
								<li>
									<a href="#yt_tab_custom"><?php echo $this->__('Custom Tab') ?></a>
								</li>
							</ul>
							<div class="yt-tab-content">						
								<?php if ( $_description ):?>
								<div id="yt_tab_decription">
									<?php echo $_description ?>
								</div>
								<?php endif;?>
								<?php if( $review_form ): ?>
								<div id="yt_tab_reviewform">
									<?php echo $this->getChildHtml('product_reviews');?>
									<?php echo $review_form; ?>
								</div>
								<?php endif;?>
								<?php if( $product_additional_data ): ?>
								<div id="yt_tab_tags">
									<?php echo $product_additional_data; ?>
								</div>
								<?php endif;?>							
																						
								<?php if ( $_additional ) : ?>
								<div id="yt_tab_additional">
									<?php echo $_additional ?>
								</div>
								<?php endif;?>
								<div id="yt_tab_custom">
									<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('custom-tab')->toHtml(); ?>
								</div>
							</div>		
						</div>
					</div>
				</div>
					
			
			
			<div class="categories-view col-md-3">
				<div class="list-categories">
					<?php echo $this->getChildHtml('catalog-left-nav') ?>
				</div>
				
				<?php if( $related_products = $this->getChildHtml('related_products') ){
					echo $related_products;
				} ?>
			</div>
			
			<script type="text/javascript">
	            //<![CDATA[
	                var productAddToCartForm = new VarienForm('product_addtocart_form');
	                productAddToCartForm.submit = function(button, url) {
	                    if (this.validator.validate()) {
	                        var form = this.form;
	                        var oldUrl = form.action;
	        
	                        if (url) {
	                           form.action = url;
	                        }
	                        var e = null;
	                        try {
	                            this.form.submit();
	                        } catch (e) {
	                        }
	                        this.form.action = oldUrl;
	                        if (e) {
	                            throw e;
	                        }
	        
	                        if (button && button != 'undefined') {
	                            button.disabled = true;
	                        }
	                    }
	                }.bind(productAddToCartForm);
	        
	                productAddToCartForm.submitLight = function(button, url){
	                    if(this.validator) {
	                        var nv = Validation.methods;
	                        delete Validation.methods['required-entry'];
	                        delete Validation.methods['validate-one-required'];
	                        delete Validation.methods['validate-one-required-by-name'];
	                        if (this.validator.validate()) {
	                            if (url) {
	                                this.form.action = url;
	                            }
	                            this.form.submit();
	                        }
	                        Object.extend(Validation.methods, nv);
	                    }
	                }.bind(productAddToCartForm);
	            //]]>
            </script>
            </div>
		</div>
	</div>
	
	
	<?php echo $this->getChildHtml('upsell_products') ?>
</div>
